<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh-cn" class="no-js">
<!--<![endif]-->
<head>
    <jsp:include page="../common/common.jsp"/>
    <link rel="stylesheet" type="text/css" href="${path}/assets/plugins/select2/select2.css"/>
    <link rel="stylesheet" type="text/css" href="${path}/assets/plugins/select2/select2-metronic.css"/>
    <link rel="stylesheet" type="text/css" href="${path}/assets/css/pages/timeline.css"/>
    <link href="${path}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
    <link href="${path}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
</head>
<body class="page-header-fixed">
<jsp:include page="../common/header.jsp"/>
<div class="clearfix">
</div>
<div class="page-container">
<div class="page-sidebar-wrapper"><jsp:include page="../common/menu.jsp"/></div>
<div class="page-content-wrapper">
<div class="page-content">
<div class="row">
<div class="col-md-12">
<div class="portlet box purple">
<div class="portlet-title">
    <div class="caption">
        <i class="fa fa-globe"></i>商机信息列表
    </div>
    <div class="tools">
        <div class="actions">
            <button type="button" id="btnA" class="btn green" onclick="oper('T')">
                <i class="fa fa-long-arrow-up"></i> 推荐到首页
            </button>
            <button type="button" class="btn gray" onclick="oper('N')">
                 不推荐
            </button>
            <button type="button" id="btnB" class="btn blue" onclick="oper('X')">
                <i class="fa fa-long-arrow-down"></i> 下架
            </button>
            <button type="button" id="btnC" class="btn yellow" onclick="oper('S')">
                <i class="fa fa-check"></i> 审核通过
            </button>
            <button type="button" id="btnDel" class="btn red">
                <i class="fa fa-trash-o"></i> 删除
            </button>
            <a href='javascript:window.open("${path}/business/downExcel?"+$("#formQuery").serialize())' class="btn blue">导出Excel</a>
        </div>
    </div>
</div>
<div class="portlet-body">
    <form id="formQuery" class="form-horizontal" action="${path}/business/list">
        <div class="form-body">
            <div class="form-group">
                <label class="col-md-1 control-label">地区</label>
                <div class="col-md-3">
                    <select id="province" name="province" class="form-control"></select>
                </div>
                <div class="col-md-2 hide">
                    <select id="city" class="form-control"></select>
                </div>
                <div class="col-md-2 hide">
                    <select id="county" class="form-control"></select>
                </div>
                <label class="col-md-1 control-label">商品分类</label>
                <div class="col-md-2">
                    <select id="classId" name="classId" class="form-control">
                        <option value="">所有</option>
                        <c:forEach items="${classList}" var="c">
                            <option value="${c.id}">${c.value0}</option>
                        </c:forEach>
                    </select>
                </div>
                <label class="col-md-1 control-label">状态</label>
                <div class="col-md-2">
                    <select id="status" name="status" class="form-control">
                        <option value="">所有</option>
                        <option value="0">待审核</option>
                        <option value="1">正常</option>
                        <option value="2">已下架</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-1 control-label">登记时间</label>
                <div class="col-md-4">
                    <div class="input-group input-large date-picker input-daterange"
                         data-date-format="yyyy-mm-dd">
                        <input type="text" class="form-control" id="fromDate" name="fromDate"
                               readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
                        <span class="input-group-addon">to</span>
                        <input type="text" class="form-control" id="toDate" name="toDate"
                               readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
                    </div>
                </div>
                <div class="col-md-2">
                    <select id="keyType" name="keyType" class="form-control">
                        <%--<option value="">模糊匹配</option>--%>
                        <option value="userName">姓名</option>
                        <option value="telephone">电话</option>
                        <option value="summary">标题</option>
                    </select>
                </div>
                <div class="col-md-3">
                    <input id="keywords" name="keywords" class="form-control"/>
                </div>
                <div class="col-md-1">
                    <button type="submit" class="btn green">查询</button>
                </div>
            </div>
        </div>
    </form>
    <table class="table table-striped table-bordered table-hover" id="businessList"></table>
    <div id="panelMoney" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"></button>
                    <h4 class="modal-title">奖励S币</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal form-row-seperated" id="panelFormMoney">
                        <div class="portlet-body">
                            <div class="tabbable">
                                <div class="tab-content no-space">
                                    <div class="tab-pane active" id="tab_general">
                                        <div class="form-body">
                                            <div class="form-group">
                                                <label class="col-md-3 control-label">S币数:</label>
                                                <div class="col-md-5">
                                                    <input type="hidden" id="businessid" name="ids"
                                                           class="form-control"/>
                                                    <input type="text" id="money" name="money"
                                                           class="form-control"/>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn blue" id="btnPanelMoney">提交</button>
                </div>
            </div>
        </div>
    </div>
    <div id="panel" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"></button>
                    <h4 class="modal-title">发送消息</h4>
                </div>
                <div class="modal-body">
                    <form id="panelForm">
                        <p>
                            <input type="hidden" id="businessId" name="businessId" value=""/>
                            <input type="hidden" id="creater" name="userId" value=""/>
                            <textarea id="textarea" name="context" class="form-control" maxlength="225"
                                      rows="3"></textarea>
                        <p>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn blue" id="btnPanel">提交</button>
                </div>
            </div>
        </div>
    </div>
    <div id="panelPL" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"></button>
                    <h4 class="modal-title">评论信息</h4>
                </div>
                <div class="modal-body">
                    <ul class="timeline">
                        <li class="timeline-green">
                            <div class="timeline-time">
														<span class="date">
															 --/--/----
														</span>
														<span class="time">
															 --:--
														</span>
                            </div>
                            <div class="timeline-icon">
                                <%-- <img class="imgRound" src="${path}/assets/img/blog/3.jpg" /> --%>
                            </div>
                            <div class="timeline-body">
                                <h2>游客</h2>

                                <div class="timeline-content">
                                    暂无评论
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="modal-footer">
                    <input type="hidden" id="businessid" value=""/>
                    <button type="button" class="btn default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <div id="panelDetail" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-full">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">商机信息修改</h4>
                </div>
                <div class="modal-body">
                    <iframe id="detail" src="" width="100%" height="300px"></iframe>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn blue">Save changes</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<jsp:include page="../common/footer.jsp"/>
<script type="text/javascript" src="${path}/assets/scripts/biz/jsAddress.js"></script>
<script type="text/javascript" src="${path}/operate/js/business.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/calendar/WdatePicker.js"></script>
<script type="text/javascript">
    var businessid;
    var msg = '${msg}';
    $(function () {
        if(msg) {
            App.bubble(200, msg);
        }
        $('#panelPL').on('shown.bs.modal', function () {
            App.ajax("${path}/business/queryDis", "businessId=" + businessid, htmlPLContent);
        });
        $("#btnDel").click(function (e) {
            if (confirm("确认删除选中的记录？"))
                oper('D');
        });
        $("#btnPanel").click(function () {
            App.ajax(_path + "/business/saveDis", $("#panelForm").serialize(), function (data) {
                if (data) {
                    switch (data.statusCode) {
                        case 200:
                            $('#panel').modal('hide');
                            oper(2);
                            break;
                        default :
                            App.bubble(500, "发送失败！");
                            break;
                    }
                }
            });
        });
        $("#btnPanelMoney").click(function () {
            App.ajax(_path + "/business/updMoney", $("#panelFormMoney").serialize(), function (data) {
                if (!data || data.statusCode === 500)
                    alert("充值失败！");
                $('#panelMoney').modal('hide');
                oper(2);
            });
        });
        addressInit('province', 'city', 'county', '北京市', '北京', '海淀区');
        var select = document.getElementById("province");
        select.options.add(new Option("所有", ""), 0);
        $("#province").val('${entity.province}');
        $("#classId").val('${entity.classId}');
        $("#status").val('${entity.status}');
        var keyType = '${entity.keyType}';
        if(keyType) $("#keyType").val(keyType);
        $("#keywords").val('${entity.keywords}');
        $("#fromDate").val('${fromDate}');
        $("#toDate").val('${toDate}');
        getBusinessList();
    });
</script>
</body>
<!-- END BODY -->
</html>